package com.wechat.page.chat.misc;

import java.time.LocalDateTime;

import com.wechat.page.utils.Times;

import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;

public class TimeDivide extends StackPane {

	private final String[] CHAT_STYLE_CLASS = { "chatting-page__chat" };
	private Label text;
	private LocalDateTime lastShowTimeStamp;

	public TimeDivide(LocalDateTime lastShowTimeStamp) {
		this.getStyleClass().addAll(CHAT_STYLE_CLASS);
		this.lastShowTimeStamp = lastShowTimeStamp;
		this.text = new Label();
		this.text.getStyleClass().add("chatting-page__divide");
		StackPane.setAlignment(this.text, Pos.CENTER);
		this.getChildren().add(this.text);
		this.init();
	}

	private void init() {
		this.text.setText(Times.formateLastTime(lastShowTimeStamp));
	}
}
